package exercises.leetcode;

/**
 * <a href="">
 * </a>
 *
 * <p><span color="#87CEEB">描述:</span>
 *
 * @author or2
 * @date 2021年10月30日 时间: 23:48
 */
public class No5900 {
    public int[] platesBetweenCandles(String s, int[][] queries) {
        int[] aux = new int[s.length()];
        for (int i = 0, tmp = 0, pre = 0, len = s.length(); i < len; i++) {
            if (s.charAt(i) == '*') tmp++;
            else pre = tmp;
            aux[i] = pre;
        }

        var res = new int[queries.length];
        for (int i = 0; i < res.length; i++) {
            int start = queries[i][0], end = queries[i][1];
            res[i] = aux[end] - aux[start];
        }

        return res;
    }
}
